package dk.benches.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Tree;
import com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class GwtBenches implements EntryPoint {

	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {
		DockPanel dock = new DockPanel();
		
		dock.setSpacing(6);
		
		VerticalPanel verticalPanel = new VerticalPanel();
		
		Tree tree = new Tree();
		TreeItem item = new TreeItem("Navigation");
		item.addItem("itemText");
		item.addItem("itemText");
		item.addItem("itemText");
		
		tree.addItem(item);
		tree.addItem(new TreeItem("Bench panel"));
		tree.addItem(new TreeItem("User panel"));
		
		verticalPanel.add(tree);
		
		dock.add(new HTML("<h1 style='color:red;'><center>GWT benches</center></h1>"),DockPanel.NORTH);
		dock.add(new HTML("<h1 style='color:green;'><center>Footer</center></h1>"),DockPanel.SOUTH);
		dock.add(tree, DockPanel.WEST);
		
		HTML contents = new HTML("This is a <code>ScrollPanel</code> contained at "
				+ "the center of a <code>DockPanel</code>.  "
				+ "By putting some fairly large contents "
				+ "in the middle and setting its size explicitly, it becomes a "
				+ "scrollable area within the page, but without requiring the use of "
				+ "an IFRAME.<br><br>"
				+ "Here's quite a bit more meaningless text that will serve primarily "
				+ "to make this thing scroll off the bottom of its visible area.  "
				+ "Otherwise, you might have to make it really, really small in order "
				+ "to see the nifty scroll bars!");

		ScrollPanel scroller = new ScrollPanel(contents);
		scroller.setSize("400px", "200px");
		
		dock.add(scroller, DockPanel.CENTER);
		
		RootPanel.get().add(dock);
		
	}
}
